package com.example.demo.beans;

import java.lang.annotation.*;

@Inherited
@Retention(RetentionPolicy.RUNTIME)
@interface MyTestAnnotation {
    String value();
}

@MyTestAnnotation("Parent Class Annotation")
class ParentClass {}

class ChildClass extends ParentClass {}

public class Main {
    public static void main(String[] args) {
        // 获取子类的注解
        MyTestAnnotation annotation = ChildClass.class.getAnnotation(MyTestAnnotation.class);
        System.out.println(annotation.value()); // 输出 "Parent Class Annotation"
    }
}